﻿using System;
using System.Collections.Generic;
using System.Text;
using Torch.WL.Business.Interface;
using Torch.FrameWork.Utility;
using Torch.WL.Business.CleanChina;
using Torch.WL.Entity.CleanChina;

namespace Torch.WL.Business
{
    public class ExpoInfo2Provider : BaseProvider<ExpoInfo2Provider.RequestDataInfo>, IDataProvider
    {
        public ExpoInfo2Provider(string _jsonInfo): base(_jsonInfo)
        {

        }

        public IMessageInfo Do()
        {
            IMessageInfo message = new MessageInfo();
            message.code = (int)MessageCodeType.Success;
            message.message = Utils.GetEnumDescription(MessageCodeType.Success);
            message.data = ProcessResponseData();

            return message;
            
        }

        private ResponseDataInfo ProcessResponseData()
        {
            //use postdata.data to process responseData           
            ResponseDataInfo responseData = new ResponseDataInfo();

            TbExpoManager expomanager = new TbExpoManager();

            TbExpoEntity expoEntity = expomanager.GetModelByCache(Constants.EXPO_ID);
            if (expoEntity == null)
                return responseData;

            responseData.img = ConfigHelper.GetConfigString("WebsiteImageUrl") + expoEntity.JiuDianZS;

            return responseData;
        }

        public class RequestDataInfo
        {
            public string name { get; set; }
            public DateTime date { get; set; }
        }

        public class ResponseDataInfo
        {
            public string img { get; set; }
        }


    }
}
